﻿@using ZhouYu.NewWorld.Model;
@{
    Layout = null;
    var deliveryAddress = ViewBag.deliveryAddress as DeliveryAddress;
}
<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>编辑用户 - QAdmin后台模板</title>
    <link rel="stylesheet" href="~/static/common/layui/css/layui.css">
    <link rel="stylesheet" href="~/static/admin/css/style.css">

    <script src="~/static/common/layui/layui.js"></script>
    <script src="~/static/common/jquery-3.3.1.min.js"></script>
    <script src="~/static/common/vue.min.js"></script>
    <script src="~/static/admin/js/config.js"></script>
    <script src="~/static/admin/js/script.js"></script>
    <title>编辑</title>
</head>
<body>
    <div class="right">
        <fieldset class="layui-elem-field layui-field-title">
            <legend>编辑用户</legend>
        </fieldset>
        <div class="layui-form">
            <input type="hidden" value="@deliveryAddress.Delivery_Id" name="Delivery_Id" id="Delivery_Id" required lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
            <div class="layui-form-item">
                <label class="layui-form-label">用户编号</label>
                <div class="layui-input-block">
                    <input type="text" value="@deliveryAddress.User_Id" name="User_Id" id="User_Id" required lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">邮编</label>
                <div class="layui-input-block">
                    <input type="text" value="@deliveryAddress.Delivery_Zipcode" name="Delivery_Zipcode" id="Delivery_Zipcode" required lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">联系电话</label>
                <div class="layui-input-block">
                    <input type="text" value="@deliveryAddress.Delivery_TelPhone" name="Delivery_TelPhone" id="Delivery_TelPhone" required lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item" id="isvip">
                <label class="layui-form-label">收件人名</label>
                <div class="layui-input-block">
                    <input type="text" value="@deliveryAddress.Delivery_Name" id="Delivery_Name" name="Delivery_Name" required lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item" id="isvip">
                <label class="layui-form-label">配送地址</label>
                <div class="layui-input-block">
                    <input type="text" value="@deliveryAddress.Delivery_Adress" id="Delivery_Adress" name="Delivery_Adress" required lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                @*<input type="button" id="commit" value="立即提交" class="layui-btn">*@
                <button class="layui-btn" type="button" lay-submit lay-filter="submit" id="tj">立即提交</button>
            </div>
        </div>
    </div>   
</body>
</html>
<script>
    //修改
    $(function () {
        $("#tj").click(function () {
            var DeliveryAddress = {};
            DeliveryAddress.Delivery_Id = $("#Delivery_Id").val();
            DeliveryAddress.User_Id = $("#User_Id").val();
            DeliveryAddress.Delivery_Zipcode = $("#Delivery_Zipcode").val();
            DeliveryAddress.Delivery_TelPhone = $("#Delivery_TelPhone").val();
            DeliveryAddress.Delivery_Name = $("#Delivery_Name").val();
            DeliveryAddress.Delivery_Adress = $("#Delivery_Adress").val();
            DeliveryAddress.Delivery_UpdateTime = $("#Delivery_UpdateTime").val();
            DeliveryAddress.Delivery_CreateTime = $("#Delivery_CreateTime").val();

            $.ajax({
                type: "Post",
                url: '/DeliveryAddress/UpdateDeliveryAddress',
                data: DeliveryAddress,
                success: function (data) {
                    if (data.Success) {
                        layer.msg('修改成功！', {
                            title: '提示框',
                            icon: 1,
                            time: 400
                        }, function () {
                            location.reload();
                            window.location.href = '/Home/DeliveryAddress';
                        });
                    } else {
                        layer.alert('修改失败！');
                    }
                }
            });
        });
    });
</script>